colorchooser: Fix the add_palette api
authorMatthias Clasen <mclasen@redhat.com>
Mon, 24 Aug 2020 21:20:17 +0000 (17:20 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 24 Aug 2020 21:20:17 +0000 (17:20 -0400)
When adding a custom palette, we need to arrange
for the custom section to stay at the bottom.

Maybe there should be a way to turn off custom
colors, too.

gtk/gtkcolorchooserwidget.c

index 087e8df0560773973a44d740a82cfd9efb5c3f87..408b3eaebdf7a6bf182cc84197dc7da3f9d9546c 100644 (file)
@@ -314,6 +314,7 @@ add_palette (GtkColorChooserWidget  *cc,
   gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
   gtk_box_append (GTK_BOX (cc->palette), grid);
+  
 
   left = 0;
   right = colors_per_line - 1;
@@ -807,6 +808,9 @@ gtk_color_chooser_widget_add_palette (GtkColorChooser *chooser,
 
   remove_default_palette (cc);
   add_palette (cc, orientation, colors_per_line, n_colors, colors, NULL);
+
+  gtk_box_reorder_child_after (GTK_BOX (cc->palette), cc->custom_label, gtk_widget_get_last_child (cc->palette));
+  gtk_box_reorder_child_after (GTK_BOX (cc->palette), cc->custom, cc->custom_label);
 }
 
 static void